package com.slz3.business.module.messageManagement.mesType.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesType.domain.MesType;
import com.slz3.business.module.messageManagement.mesType.domain.MesTypeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesTypeTransactionalServiceImpl implements MesTypeTransactionalService {

    @Override
    public MesType modify(MesType mesTypeNew) {
        Repositorys.mesType.test();
        Repositorys.mesType.save(MesTypeFactory.initBaseFields());
        System.err.println(1 / 0);
        mesTypeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesType.saveAndFlush(mesTypeNew);
    }

    @Override
    public List<MesType> batchModify(List<MesType> mesTypeList) {
        return Repositorys.mesType.saveAll(mesTypeList);
    }
}
